package com.xiewz.config;

import com.xiewz.pojo.SimpleBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
@ConditionalOnClass/*(SimpleBean.class)*/   //@ConditionalOnClass：当类路径classpath下有指定的类的情况下进行自动配置
public class MyAutoConfiguration {
    static {
        System.out.println("MyAutoConfiguration init....");
    }

    @Bean
    public SimpleBean simpleBean() {
        return new SimpleBean();
    }

    // @Autowired
    // private SimpleBean simpleBean;
    //
    // public void test(){
    //     simpleBean.getId();
    //
    // }
}
